import 'package:flutter/material.dart';
import 'package:flutter_demo/start_up/function_widgets/alerts/0x00_aleret_item.dart';

class LoadingPage extends StatelessWidget { 
  @override
  Widget build(BuildContext context) {


    showLoadingDialog() {
      showDialog(
        context: context,
        barrierDismissible: true,
        builder: (context) {
          return AlertDialog(
            content: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                CircularProgressIndicator(),
                Padding(
                  padding: const EdgeInsets.only(
                    top: 26
                  ),
                  child: Text("Loading ..."),
                )
              ],
            ),
          );
        },
      );
    }

    showLoadingDialog2() {
      showDialog(
        context: context,
        barrierDismissible: true,
        builder: (context) {
          return UnconstrainedBox(
            constrainedAxis: Axis.vertical,
            child: SizedBox(
              width: 280,
              child: AlertDialog(
                content: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    CircularProgressIndicator(),
                    Padding(
                      padding: const EdgeInsets.only(
                        top: 26
                      ),
                      child: Text("Loading ..."),
                    )
                  ],
                ),
              ),
            ),
          );
        },
      );
    }

    return Scaffold(
      appBar: AppBar(
        title: Text("Loading Page"),
      ),
      body: Padding(
        padding: EdgeInsets.only(
          top: 18,
          bottom: 18
        ),
        child: ListView(
          children: <Widget>[
            AlertItem("Loading ...", showLoadingDialog),
            AlertItem("Loading 2 ...", showLoadingDialog2),
          ],
        ),
      ),
    );
  }
}